package com.baidu.dao;

import com.baidu.pojo.CheckItem;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import java.util.List;

@Repository
public interface CheckItemDao {
    @Select("select * from t_checkitem")
    List<CheckItem> findAll();

    @Insert("insert into t_checkitem(code,name,sex,age,price,type,remark,attention)" +
            " values(#{code},#{name},#{sex},#{age},#{price},#{type},#{remark},#{attention})")
    int add(CheckItem checkItem);

    Page<CheckItem> findByCondition(String queryString);

    // 查询检查组
    int findByCheckGroup(Integer id);

    // 删除
    @Delete("delete from t_checkitem where id = #{id}")
    int delete(Integer id);

    CheckItem findById(Integer id);

    @Update("update t_checkitem set code = #{code}, name = #{name}, sex = #{sex}, age = #{age}, price = #{price}," +
            "type = #{type}, remark = #{remark}, attention = #{attention} where id = #{id}")
    int update(CheckItem checkItem);
}
